package cn.edu.scau.cmi.duke.adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AdapterOfObject implements Target{

	@Override
	public List<Student> sortStudent(List<Student> studentList) {
		List<Integer> numberList=new ArrayList<Integer>();
		Map<Integer,Student> number_student=new HashMap<Integer,Student>();
		for(int i=0;i<studentList.size();i++) {
			Student student=studentList.get(i);
			Integer number=student.getId();
			number_student.put(number, student);
			numberList.add(number);
		}
		SortUtil.sortInt(numberList);
		for(int i=0;i<numberList.size();i++) {
			studentList.set(i, number_student.get(numberList.get(i)));
		}
		return studentList;
	}

}
